package com.qianf.wisdomOrientation.controller;


import com.qianf.wisdomOrientation.entity.ResponseData;
import com.qianf.wisdomOrientation.entity.User;
import com.qianf.wisdomOrientation.mapper.UserMapper;
import com.qianf.wisdomOrientation.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author mkHeart
 * @since 2021-07-08
 */

@Api("用户相关接口") // 标记当前控制器需要在swagger 显示
@RestController
@RequestMapping("/wisdomOrientation/user")
public class UserController {
    @Autowired
    private UserService service;
    // produces = "application/json" 返回数据时json 数据
    @ApiOperation(value = "根据专业id 查找 学生",produces = "application/json")
    @RequestMapping(path = "/findAllUser",method = RequestMethod.GET)

    public ResponseData findAllUser(int classid) {
        ResponseData<User> responseData = new ResponseData<>();
        User userById = service.findUserById(classid);

        responseData.setCode(0);

        responseData.setData(userById);

        return responseData;
    }

    // produces = "application/json" 返回数据时json 数据
    @ApiOperation(value = "根据id 查找 学生",produces = "application/json")
    @RequestMapping(path = "/findUserById",method = RequestMethod.GET)

    public ResponseData findUserById(int studentid) {
        ResponseData<User> responseData = new ResponseData<>();
        User userById = service.findUserById(studentid);

        responseData.setCode(0);

        responseData.setData(userById);

        return responseData;
    }
// produces = "application/json" 返回数据时json 数据
    @ApiOperation(value = "根据id 查找 学生 办理进度",produces = "application/json")
    @RequestMapping(path = "/findUserTransaction",method = RequestMethod.GET)

    public ResponseData findUserTransaction(int studentid) {
        ResponseData<User> responseData = new ResponseData<>();
        User userTransaction = service.findUserTransaction(studentid);

        responseData.setCode(0);

        responseData.setData(userTransaction);

        return responseData;
    }

}

